﻿using System;
using System.Collections.Generic;


namespace Qetza.TeamFoundation.WorkItemQuery.Admin
{
    /// <summary>
    /// Defines the contract that a work item query command must implement.
    /// </summary>
    public interface ICommand
    {
        #region Properties

        /// <summary>
        /// Gets the command's allowed parameters.
        /// </summary>
        /// <value>
        /// An enumeration of allowed parameters.
        /// </value>
        IEnumerable<ParameterInfo> AllowedParameters { get; }

        /// <summary>
        /// Gets the command name.
        /// </summary>
        /// <value>
        /// The command name.
        /// </value>
        string Name { get; }

        /// <summary>
        /// Gets the command help text.
        /// </summary>
        /// <value>
        /// The command help text.
        /// </value>
        string HelpText { get; }

        #endregion

        #region Methods

        /// <summary>
        /// Executes the command with the specified parameters.
        /// </summary>
        /// <param name="parameters">
        /// The command parameters grouped by name/value.
        /// </param>
        void Execute(IDictionary<string, string> parameters);

        /// <summary>
        /// Validates the specified parameter values.
        /// </summary>
        /// <param name="parameters">
        /// The command parameter values.
        /// </param>
        /// <exception cref="InvalidParameterException">
        /// a parameter value is invalid.
        /// </exception>
        void ValidateParameters(IDictionary<string, string> parameters);

        #endregion
    }
}
